import request from '@/utils/http'

// 分页查询
export const getOrderPageAPI = (params) => {
  return request({
    url: 'admin/order/page',
    method: 'GET',
    params
  });
};

// 删除
export const deleOrderAPI = (ids) => {
  return request({
    url: 'admin/order',
    method: 'DELETE',
    params: {
      ids
    }
  });
};

// 发货
export const shipOrderAPI = (id) => {
  return request({
    url: 'admin/order/ship',
    method: 'PUT',
    params: {
      id
    }
  });
};

// 运输
export const transportOrderAPI = (id) => {
  return request({
    url: 'admin/order/transport',
    method: 'PUT',
    params: {
      id
    }
  });
};

// 取消
export const cancelOrderAPI = (id) => {
  return request({
    url: 'admin/order/cancel',
    method: 'PUT',
    params: {
      id
    }
  });
};

// 查询
export const getOrderAPI = (id) => {
  return request({
    url: '/admin/order',
    method: 'GET',
    params: {
      id
    }
  })
}

//修改
export const editOrderAPI = (params) => {
  return request({
    url: 'admin/order',
    method: 'PUT',
    params
  });
};

// 订单详情
export const getCheckInfoAPI = () => {
  return request({
    url: '/order/pre'
  })
}

// 创建订单
export const createOrderAPI = (data) => {
  return request({
    url: '/order',
    method: 'POST',
    data
  })
}

//获取用户商品列表
export const getUserOrder = (params) => {
  return request({
    url: '/member/order',
    method: 'GET',
    params
  })
}

// 用户取消订单
export const userCancelOrderAPI = (id) => {
  return request({
    url: '/member/order/cancel',
    method: 'PUT',
    params: {
      id
    }
  });
};

// 确认收货
export const confirmReceiveAPI = (id) => {
  return request({
    url: '/member/order/confirm',
    method: 'PUT',
    params: {
      id
    }
  });
};

// 评论订单
export const commentOrderAPI = (data) => {
  return request({
    url: '/member/order/comment',
    method: 'POST',
    data
  });
};